package com.tfjybj.itoo.exam.ext.mongo;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
import java.util.List;

/**
 * @author 商俊帅
 * @date 2022/01/13 18:51
 **/
@Data
@Document("QuestionTemplate")
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class QuestionTemplate {

    /**
     * 总模板
     */
    @Id
    private String id;

    private String name;

    private String courseId;

    private Integer status;

    private String operator;

    protected Integer totalNumber;

    private Double score;

    private String organizingType;

    private Integer isDelete;

    private Date  createTime;

    private Date updateTime;

    protected String description;

    /**
     * 每个题型的详细信息
     */
    private List<QuestionTemplateDetail> questionTemplateDetail;


    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class QuestionTemplateDetail{

        @Id
        private String id;

        private String templateId;

        private String questionTypeId;

        /**
         * 题型的名称
         */
        private String questionName;

        private Integer questionNumber;

        /**
         * 每题几分
         */
        private String smallQuestionScore;

        /**
         * 该题型总分
         */
        private String questionScore;

        /**
         * 可以设置为List。目前值：随机和章节的id
         */
        private String questionClassifyId;

        /**
         * 是否按空给分
         */
        private Integer isBlanks;

        /**
         * 选项是否乱序
         */
        private Integer optionDisorder;

        /**
         * 漏选是否给分
         */
        private Integer messingPoints;

        /**
         * 漏选分数
         */
        private Integer messingPointsScore;

        /**
         * 题型描述
         */
        private String questionTypeDescribe;

        /**
         * 是否含有必抽题
         */
        private Integer isExtract;

        /**
         * 是否含有自定义抽题
         */
        private Integer isCustom;

        /**
         * 题型顺序
         */
        private Integer questionTypeOrder;

        /**
         * 难度系数
         */
        private Integer degree;

        private Integer isDelete = 0;

        private Date  createTime;

        private Date updateTime;

        /**
         * 每个题型的必抽题
         */
        private List<QuestionTemplateExtract> questionTemplateExtracts;

        /**
         * 每个题型的自定义抽题
         */
        private List<QuestionTemplateCustom> questionTemplateCustoms;
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class QuestionTemplateExtract{

        private String id;

        private String questionId;

        private String templateDetailsId;

        private String operator;

        private Integer isDelete;

        private Date createTime;

        private Date updateTime;


    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    @Builder
    public static class QuestionTemplateCustom{

        private String id;

        private String questionClassifyId;

        private Integer questionNumber;

        private Integer degree;

        private String questionScore;

        private String templateDetailsId;

        private Integer isSenior;

        private Integer isDelete = 0;

        private Date  createTime;

        private Date updateTime;
    }
}
